package com.sls.game.supply.deal;

import java.io.File;
import java.util.List;

import com.sls.core.util.PropertiesUtil;
import com.sls.game.parser.jieyitong.ParseConfigOfJieyitong;
import com.sls.game.parser.nutsnet.NutsNetServerSaxParseXml;
import com.sls.game.parser.tencent.ParseTencentConfigFile;
import com.sls.game.parser.xingqitian.XingConfigRead;
import com.sls.game.pojo.GoodsOrderInfo;
import com.sls.game.pojo.NutsNetServerInfo;
import com.sls.game.pojo.TencentGoodsInfo;
import com.sls.game.pojo.jieyitong.JieyitongConfigInfo;
import com.sls.game.pojo.xingqitian.XingConfigInfo;

/**
 * 
 * @Description：获取各个上游的账号
 * @author Wangxuegang
 * @Date：2013-5-30
 * 
 */
public class AccountNoDeal {

	/**
	 * 腾讯的账号
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getTencentAccount(
			List<GoodsOrderInfo> list) {
		TencentGoodsInfo tencentGoodsInfo = ParseTencentConfigFile
				.readTencentConfigFile();
		if (tencentGoodsInfo != null) {
			String mch_id_zhejiang = tencentGoodsInfo.getMch_id_zhejiang()
					.trim();
			String mch_id_guangdong = tencentGoodsInfo.getMch_id_guangdong()
					.trim();
			String mch_id_guangxi = tencentGoodsInfo.getMch_id_guangxi().trim();
			String mch_id_yunnan = tencentGoodsInfo.getMch_id_yunnan().trim();
			String mch_id_shandong = tencentGoodsInfo.getMch_id_shandong()
					.trim();
			String mch_id_jiangsu = tencentGoodsInfo.getMch_id_jiangsu().trim();
			String mch_id_jiangxi = tencentGoodsInfo.getMch_id_jiangxi().trim();
			String mch_id_hubei = tencentGoodsInfo.getMch_id_hubei().trim();
			String mch_id_sichuan = tencentGoodsInfo.getMch_id_sichuan().trim();
			String mch_id_henan = tencentGoodsInfo.getMch_id_henan().trim();
			String mch_id_shanghai = tencentGoodsInfo.getMch_id_shanghai()
					.trim();
			String mch_id_hunan = tencentGoodsInfo.getMch_id_hunan().trim();
			String mch_id_anhui = tencentGoodsInfo.getMch_id_anhui().trim();
			String mch_id_fujian = tencentGoodsInfo.getMch_id_fujian().trim();

			GoodsOrderInfo zhejiang = new GoodsOrderInfo();
			zhejiang.setRegisterAccount(mch_id_zhejiang);
			zhejiang.setRegisterAccountName("腾讯--浙江工号");

			GoodsOrderInfo guangdong = new GoodsOrderInfo();
			guangdong.setRegisterAccount(mch_id_guangdong);
			guangdong.setRegisterAccountName("腾讯--广东工号");

			GoodsOrderInfo guangxi = new GoodsOrderInfo();
			guangxi.setRegisterAccount(mch_id_guangxi);
			guangxi.setRegisterAccountName("腾讯--广西工号");

			GoodsOrderInfo yunnan = new GoodsOrderInfo();
			yunnan.setRegisterAccount(mch_id_yunnan);
			yunnan.setRegisterAccountName("腾讯--云南工号");

			GoodsOrderInfo shandong = new GoodsOrderInfo();
			shandong.setRegisterAccount(mch_id_shandong);
			shandong.setRegisterAccountName("腾讯--山东工号");

			GoodsOrderInfo jiangsu = new GoodsOrderInfo();
			jiangsu.setRegisterAccount(mch_id_jiangsu);
			jiangsu.setRegisterAccountName("腾讯--江苏工号");

			GoodsOrderInfo jiangxi = new GoodsOrderInfo();
			jiangxi.setRegisterAccount(mch_id_jiangxi);
			jiangxi.setRegisterAccountName("腾讯--江西工号");

			GoodsOrderInfo hubei = new GoodsOrderInfo();
			hubei.setRegisterAccount(mch_id_hubei);
			hubei.setRegisterAccountName("腾讯--湖北工号");

			GoodsOrderInfo sichuan = new GoodsOrderInfo();
			sichuan.setRegisterAccount(mch_id_sichuan);
			sichuan.setRegisterAccountName("腾讯--四川工号");

			GoodsOrderInfo henan = new GoodsOrderInfo();
			henan.setRegisterAccount(mch_id_henan);
			henan.setRegisterAccountName("腾讯--河南工号");

			GoodsOrderInfo shanghai = new GoodsOrderInfo();
			shanghai.setRegisterAccount(mch_id_shanghai);
			shanghai.setRegisterAccountName("腾讯--上海工号");

			GoodsOrderInfo hunan = new GoodsOrderInfo();
			hunan.setRegisterAccount(mch_id_hunan);
			hunan.setRegisterAccountName("腾讯--湖南工号");

			GoodsOrderInfo anhui = new GoodsOrderInfo();
			anhui.setRegisterAccount(mch_id_anhui);
			anhui.setRegisterAccountName("腾讯--安徽工号");

			GoodsOrderInfo fujian = new GoodsOrderInfo();
			fujian.setRegisterAccount(mch_id_fujian);
			fujian.setRegisterAccountName("腾讯--福建工号");

			list.add(zhejiang);
			list.add(guangdong);
			list.add(guangxi);
			list.add(yunnan);
			list.add(shandong);
			list.add(jiangsu);
			list.add(jiangxi);
			list.add(hubei);
			list.add(sichuan);
			list.add(henan);
			list.add(shanghai);
			list.add(hunan);
			list.add(anhui);
			list.add(fujian);
		}
		return list;
	}

	/**
	 * 沃谷的账号
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getWoguAccount(List<GoodsOrderInfo> list) {
		String merchantid = PropertiesUtil.getValue("wogreat.merchant.id",
				"wogreat.properties").trim();
		GoodsOrderInfo wogu = new GoodsOrderInfo();
		wogu.setRegisterAccount(merchantid);
		wogu.setRegisterAccountName("沃谷--工号");

		list.add(wogu);
		return list;
	}

	/**
	 * 易百米
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getEbaimiAccount(
			List<GoodsOrderInfo> list) {
		String oid_reguser = PropertiesUtil.getValue(
				"ebaimi.zhifubao.oid_reguser", "ebaimi.properties").trim();
		GoodsOrderInfo yibaimi = new GoodsOrderInfo();
		yibaimi.setRegisterAccount(oid_reguser);
		yibaimi.setRegisterAccountName("易百米--工号");

		list.add(yibaimi);
		return list;
	}

	/**
	 * 恩付
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getEnfuAccount(List<GoodsOrderInfo> list) {
		String merchantid = PropertiesUtil.getValue("enfu.server.merchantid",
				"enfu.properties").trim();
		GoodsOrderInfo enfu = new GoodsOrderInfo();
		enfu.setRegisterAccount(merchantid);
		enfu.setRegisterAccountName("恩付--工号");

		list.add(enfu);
		return list;
	}

	/**
	 * 捷易通
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getJieyitongAccount(
			List<GoodsOrderInfo> list) {
		JieyitongConfigInfo info = ParseConfigOfJieyitong.parseConfigInfo();
		if (info != null) {
			String merchantid = info.getUserid().trim();
			GoodsOrderInfo jieyitong = new GoodsOrderInfo();
			jieyitong.setRegisterAccount(merchantid);
			jieyitong.setRegisterAccountName("捷易通--工号");

			list.add(jieyitong);
		}
		return list;
	}

	/**
	 * 坚果网络
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getNutsnetAccount(
			List<GoodsOrderInfo> list) {
		String supUserId = null;
		// 从xml配置文件中读取坚果网络服务ip和port
		List<NutsNetServerInfo> serverList = NutsNetServerSaxParseXml
				.parseXmlString("conf" + File.separator + "nutsNetServer.xml");
		GoodsOrderInfo jianguo = new GoodsOrderInfo();
		if (serverList.size() > 0) {
			for (NutsNetServerInfo info : serverList) {
				supUserId = info.getSupUserId();
				jianguo.setRegisterAccount(supUserId);
				jianguo.setRegisterAccountName("坚果网络--工号");
			}
		}
		list.add(jianguo);
		return list;
	}

	/**
	 * 星启天
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getXingqtAccount(
			List<GoodsOrderInfo> list) {
		String userNo = null;
		XingConfigInfo info = XingConfigRead.readConfig();
		GoodsOrderInfo xingqi = new GoodsOrderInfo();
		if (info != null) {
			userNo = info.getUserNo();
			xingqi.setRegisterAccount(userNo);
			xingqi.setRegisterAccountName("星启天--工号");
		}
		list.add(xingqi);
		return list;
	}

	/**
	 * 云恩
	 * 
	 * @param list
	 * @return
	 */
	public static List<GoodsOrderInfo> getYunenAccount(List<GoodsOrderInfo> list) {
		String merchantid = PropertiesUtil.getValue("yunen.merchant.id",
				"yunen.properties").trim();
		GoodsOrderInfo yunen = new GoodsOrderInfo();
		yunen.setRegisterAccount(merchantid);
		yunen.setRegisterAccountName("云恩--工号");
		list.add(yunen);
		return list;
	}

}
